# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=apostrophe
pkgver=3.2
pkgrel=0
pkgdesc="distraction free Markdown editor for GNU/Linux made with GTK+"
url="https://gitlab.gnome.org/World/apostrophe"
arch="aarch64 x86_64" # py3-pypandoc
license="GPL-3.0-or-later"
depends="
	apostrophe-revealjs
	font-fira-otf
	gtksourceview5
	libadwaita
	libhandy1
	libspelling
	py3-cairo
	py3-chardet
	py3-enchant
	py3-gobject3
	py3-levenshtein
	py3-pypandoc
	py3-regex
	py3-setuptools
	webkit2gtk-6.0
	"
makedepends="meson glib-dev gobject-introspection-dev gettext-dev gtk4.0-dev
	libadwaita-dev libhandy1-dev sassc"
checkdepends="appstream-glib desktop-file-utils"
subpackages="$pkgname-lang $pkgname-pyc"
source="https://gitlab.gnome.org/World/apostrophe/-/archive/v$pkgver/apostrophe-v$pkgver.tar.gz"
builddir="$srcdir/$pkgname-v$pkgver"

prepare() {
	default_prepare
	# fix font finding
	sed -i 's|/app/share/fonts/FiraSans-Regular.ttf|/usr/share/fonts/OTF/FiraSans-Regular.otf|' \
		data/media/css/web/base.css
	sed -i 's|/app/share/fonts/FiraMono-Regular.ttf|/usr/share/fonts/OTF/FiraMono-Regular.otf|' \
		data/media/css/web/base.css
}

build() {
	abuild-meson . output
	meson compile -C output
}

check() {
	meson test --no-rebuild --print-errorlogs -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

sha512sums="
877dde1d8ab9a8bab9e269959ef2d86a65a225ba40b4a292b414dd670124c79dc86da7dbedcd70e2cd38da70bb3bd22794669e6c7812ae5d57bb3ad3ec2608b4  apostrophe-v3.2.tar.gz
"
